﻿using HZU.ZP.Data.Interfaces.Resume;
using HZU.ZP.Domain.IService.Resume;
using HZU.ZP.Domain.Model.Resume;
using HZU.ZP.Domain.ServiceImpl.Mappers.Resume;
using System;
using System.Collections.Generic;
using System.Text;

namespace HZU.ZP.Domain.ServiceImpl.PCSvc.Resume
{
    public class InformationService:IInformationService
    {
        private InformationMapper _mapper = new InformationMapper();
        private IInformationDao _sqlData;
        public InformationService(IInformationDao sqlData)
        {
            _sqlData = sqlData;
        }

        public bool AddInformation(Information information)
        {
            var infoDao = _mapper.MapToDao(information);
            _sqlData.AddInformation(infoDao);
            return true;
        }

        public bool DeleteInformation(int id)
        {
            _sqlData.DeleteInformation(id);
            return true;
        }

        public Information GetInformation(int applicantId)
        {
            return _mapper.MapToDomain(_sqlData.GetInformation(applicantId));
        }

        public bool UpdateInformation(Information information)
        {
            var infoDao = _mapper.MapToDao(information);
            _sqlData.UpdateInformation(infoDao);
            return true;
        }
    }
}
